﻿using System;
using System.Reflection;
using LINQPad.OpenAccess.Helpers;

namespace LINQPad.OpenAccess.Metadata
{
    /// <summary>
    /// <see cref="IAssemblyParseResult"/>
    /// </summary>
    public partial class AssemblyParseResult : IAssemblyParseResult
    {
        #region Public

        #region - Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="AssemblyParseResult" /> class.
        /// </summary>
        /// <param name="contextTypes">The context types.</param>
        /// <param name="metadataSources">The metadata sources.</param>
        public AssemblyParseResult( IContextTypeInfo[] contextTypes, IMetadataSourceInfoWithSource[] metadataSources )
        {
            this.ContextTypes = contextTypes ?? new IContextTypeInfo[0];
            this.MetadataSources = metadataSources ?? new IMetadataSourceInfoWithSource[0];
        }

        #endregion

        #endregion

        #region IAssemblyParseResult Members

        /// <summary>
        /// Gets the context types.
        /// </summary>
        /// <value>
        /// The context types.
        /// </value>
        public IContextTypeInfo[] ContextTypes { get; private set; }
        /// <summary>
        /// Gets a value indicating whether the parse result is empty.
        /// </summary>
        /// <value>
        /// <c>true</c> if the parse result is empty; otherwise, <c>false</c>.
        /// </value>
        public bool IsEmpty
        {
            get { return this.ContextTypes.Length == 0; }
        }

        /// <summary>
        /// Gets the metadata sources.
        /// </summary>
        /// <value>
        /// The metadata sources.
        /// </value>
        public IMetadataSourceInfoWithSource[] MetadataSources { get; private set; }

        #endregion
    }
}